// pages/classify/classify.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    cateItems: [
      {
        cate_id: 1,
        cate_name: "菌菇干货",
        ishaveChild: true,
        children:
        [
          {
            child_id: 1,
            name: '木耳',
          },
          {
            child_id: 2,
            name: '香菇',
          },
          {
            child_id: 3,
            name: '银耳',
          },
          {
            child_id: 4,
            name: '海带',
          }
        ]
      },
      {
        cate_id: 2,
        cate_name: "散秤调味",
        ishaveChild: true,
        children:
        [
          {
            child_id: 1,
            name: '辣椒',
            
          },
          {
            child_id: 2,
            name: '胡椒',
            
          },
          {
            child_id: 3,
            name: '孜然',
            
          },
          {
            child_id: 4,
            name: '八角',
            
          },
          {
            child_id: 5,
            name: '花椒',
            
          },
        ]
      },
      {
        cate_id: 3,
        cate_name: "油盐酱醋",
        ishaveChild: true,
        children:
        [
          {
            child_id: 1,
            name: '食用油',
            
          },
          {
            child_id: 2,
            name: '盐',
            
          },
          {
            child_id: 3,
            name: '酱油',
            
          },
          {
            child_id: 4,
            name: '醋',
            
          }
        ]
      },
      {
        cate_id: 4,
        cate_name: "调味品",
        ishaveChild: false,
        children: []
      }
    ],
    curNav: 1,
    curIndex: 0
  },

  //事件处理函数  
  switchRightTab: function (e) {
    // 获取item项的id，和数组的下标值  
    let id = e.target.dataset.id,
      index = parseInt(e.target.dataset.index);
    // 把点击到的某一项，设为当前index  
    this.setData({
      curNav: id,
      curIndex: index
    })
  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {
  
  }
})